package net.zjitc.controller;

import net.zjitc.common.ResponseResult;
import net.zjitc.exception.ReportsException;
import net.zjitc.service.ReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 毛钰深
 * @create 2022/2/6
 */
@RestController
public class ReportsController {

    @Autowired
    private ReportsService reportsService;

    @PreAuthorize("hasAuthority('148')")
    @GetMapping("/reports/type/1")
    public ResponseResult getReportsOne(){
        ResponseResult res;
        try {
            res=reportsService.getReportsOne();
        } catch (ReportsException e) {
            res=new ResponseResult();
            res.setError(e.getMessage());
        }
        return res;
    }

}
